<?
// Skin Block: Top Links Javascript menu code
// Displays Top Links
// -> All pages
// Creator: Matt
$skin_parse = '';
global $can_create_folders,$can_view_folders;
$skin_parse = '
<script>
function createjsDOMenu() 
{
	
  mainMenu1 = new jsDOMenu(130);
  with (mainMenu1) {
    addMenuItem(new menuItem("Site Home", "m_mhome", "'.makeXuLink('index.php', 'p=home').'"));
  }
  ';

   $skin_parse .= ' mainMenu3 = new jsDOMenu(170);
  with (mainMenu3) {
	addMenuItem(new menuItem("Validate File Links", "m_valid", "'.makeXuLink('index.php', 'p=linkchecker').'"));
 ';
 if($can_view_folders)
   {
	$skin_parse .= 'addMenuItem(new menuItem("View Folders", "m_view_folder", "'.makeXuLink('index.php', 'p=view').'"));';
	}

	if($can_create_folders)
  	{
   		$skin_parse .= ' addMenuItem(new menuItem("Manage Folders", "m_folder1", "'.makeXuLink('index.php', 'p=folders').'"));';
   	}
	$skin_parse .= '}
';
  
  
  
  if($_SESSION["loggedin"]) 
	{
   $skin_parse .= '
    mainMenu5 = new jsDOMenu(160);
  with (mainMenu5) 
  {
    addMenuItem(new menuItem("User CP", "m_user", "'.makeXuLink('index.php', 'p=usercp').'"));
	addMenuItem(new menuItem("Manage Files", "m_file", "'.makeXuLink('index.php', 'p=files').'"));';
	
	if($can_create_folders)
  	{
   		$skin_parse .= ' addMenuItem(new menuItem("Manage Folders", "m_folder", "'.makeXuLink('index.php', 'p=userFolders').'"));';
   	}
		
  	  $skin_parse .= ' 
		addMenuItem(new menuItem("Cancel Account", "m_cancel", "'.makeXuLink('index.php', 'p=delacc').'"));
	}
	
  mainMenu8 = new jsDOMenu(160);
  with (mainMenu8) 
  {
    addMenuItem(new menuItem("Logout", "m_logout", "'.makeXuLink('index.php', 'p=logout').'"));
  }
  
  ';
  }
  else
  {
  	  $skin_parse .= ' mainMenu5 = new jsDOMenu(110);
  with (mainMenu5) {
    addMenuItem(new menuItem("Login", "m_login", "'.makeXuLink('index.php', 'p=login').'"));
  }
  
 mainMenu8 = new jsDOMenu(200);
  with (mainMenu8) {
    addMenuItem(new menuItem("Get Premium Account", "m_premium", "'.makeXuLink('index.php', 'p=fastpass').'"));
  }';
  }
      $skin_parse .= '
	    mainMenu9 = new jsDOMenu(170);
  with (mainMenu9) 
  {
    addMenuItem(new menuItem("File Upload Feeds", "m_rss", "'.makeXuLink('index.php', 'p=rss').'"));
  }
	  mainMenu6 = new jsDOMenu(120);
  with (mainMenu6) {
    addMenuItem(new menuItem("Read News", "m_news", "'.makeXuLink('index.php', 'p=news').'"));
  }
  
  mainMenu7 = new jsDOMenu(110);
  with (mainMenu7) {
    addMenuItem(new menuItem("Read FAQ", "m_faq", "'.makeXuLink('index.php', 'p=faq').'"));
  }
  
  menuBar = new jsDOMenuBar("static", "staticMenuBar", "", "", ';
  if($_SESSION["loggedin"]) 
  {
	if($can_create_folders or $can_view_folders) 
	{
		$skin_parse .= '800';
	}
	else
	{
  		$skin_parse .= '740';
	}
  }
  else
  {
  	if($can_create_folders or $can_view_folders) 
	{
		$skin_parse .= '740';
	}
	else
	{
  		$skin_parse .= '660';
	}
  }
  $skin_parse .= '); //CREATE MAIN MENU ITEMS
  with (menuBar) 
{
	addMenuBarItem( new menuBarItem("Home", mainMenu1, "home"));
	addMenuBarItem( new menuBarItem("Tools", mainMenu3, "tools"));';
	if($_SESSION["loggedin"]) 
	{
		$skin_parse .= '
		addMenuBarItem( new menuBarItem("User CP", mainMenu5, "user"));
		';
	}
	else
	{
	    $skin_parse .= '
		addMenuBarItem( new menuBarItem("Login", mainMenu5, "login"));
		addMenuBarItem( new menuBarItem("Premium", mainMenu8, "premium"));
		';
	}
   $skin_parse .= '
    addMenuBarItem( new menuBarItem("RSS", mainMenu9, "rss"));
	addMenuBarItem( new menuBarItem("News", mainMenu6, "news"));
	addMenuBarItem( new menuBarItem("F.A.Q.", mainMenu7, "faq"));';
	
	if($_SESSION["loggedin"]) 
	{
		$skin_parse .= '
		addMenuBarItem( new menuBarItem("Logout", mainMenu8, "logout"));
		';
	}
  $skin_parse .= '}
  
  // #1
  menuBar.items.home.showIcon("img_home", "img_home", "img_home");
  mainMenu1.items.m_mhome.showIcon("img_home", "img_home", "img_home");';
  
  $skin_parse .= ' 
	  // #3
	  menuBar.items.tools.showIcon("img_mods", "img_mods", "img_mods");
  mainMenu3.items.m_valid.showIcon("img_validate", "img_validate", "img_validate");
  ';

  		if($can_create_folders)
  		{
   			$skin_parse .= 'mainMenu3.items.m_folder1.showIcon("img_folder", "img_folder", "img_folder");';
   		}
   
   if($can_view_folders)
   {
	$skin_parse .= 'mainMenu3.items.m_view_folder.showIcon("img_folder1", "img_folder1", "img_folder1");';
	}
  
      if($_SESSION["loggedin"]) 
  {
      $skin_parse .= '// #5
      menuBar.items.user.showIcon("img_user", "img_user", "img_user");
      mainMenu5.items.m_user.showIcon("img_cogs", "img_cogs", "img_cogs");
	  mainMenu5.items.m_file.showIcon("img_file", "img_file", "img_file");
      mainMenu5.items.m_cancel.showIcon("img_user1", "img_user1", "img_user1");';
	  
	   if($can_create_folders)
  {
   $skin_parse .= 'mainMenu5.items.m_folder.showIcon("img_folder", "img_folder", "img_folder");';
   }
	  
	    // #8
 $skin_parse .= ' menuBar.items.logout.showIcon("img_logout", "img_logout", "img_logout");
  mainMenu8.items.m_logout.showIcon("img_logout", "img_logout", "img_logout");
	  ';
	  
  }
  else
  {
  	   $skin_parse .= ' 
	  // #3
  menuBar.items.login.showIcon("img_login", "img_login", "img_login");
  mainMenu5.items.m_login.showIcon("img_login", "img_login", "img_login");
  // #8
      menuBar.items.premium.showIcon("img_premium", "img_premium", "img_premium");
      mainMenu8.items.m_premium.showIcon("img_premium", "img_premium", "img_premium");';
  }
  $skin_parse .= '
  
  // #6
  menuBar.items.news.showIcon("img_news", "img_news", "img_news");
  mainMenu6.items.m_news.showIcon("img_news", "img_news", "img_news");

  // #7
  menuBar.items.faq.showIcon("img_caution", "img_caution", "img_caution");
  mainMenu7.items.m_faq.showIcon("img_caution", "img_caution", "img_caution");

  // #9
  menuBar.items.rss.showIcon("img_rss", "img_rss", "img_rss");
  mainMenu9.items.m_rss.showIcon("img_rss", "img_rss", "img_rss"); 
  
}
</script>';
?>